package com.ruoyi.mall.product.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;

import java.util.List;

/**
 * 商品三级分类对象 pms_category
 *
 * TODO 这里思考一个问题，为什么ruoyi的所有实体类都需要继承BaseEntity
 *
 * @author zhangqishu
 * @date 2022-05-25
 */
public class PmsCategory  {
    private static final long serialVersionUID = 1L;

    /**
     * 分类id
     */
    private Long id;

    /**
     * 分类名称
     */
    @Excel(name = "分类名称")
    private String name;

    /**
     * 父分类id
     */
    @Excel(name = "父分类id")
    private Long parentId;

    /**
     * 是否显示[0-不显示，1显示]
     *   @TableLogic 逻辑删除注解,标在这个字段上代表这个字段成为逻辑删除的一个标识
     */
    @Excel(name = "是否显示[0-不显示，1显示]")
    @TableLogic(value = "1",delval = "0")
    @TableField("status")
    private Integer status;

    /**
     * 父分类id
     */
    @Excel(name = "父分类id")
    private Integer level;

    /**
     * 排序
     */
    @Excel(name = "排序")
    private Integer sort;

    /**
     * 图标地址
     */
    @Excel(name = "图标地址")
    private String icon;

    /**
     * 计量单位
     */
    @Excel(name = "计量单位")
    private String unit;

    /**
     *   @TableField(exist = false) mybatis-plus注解，表示这个字段在数据库中不存在
     */
    @TableField(exist = false)
    private List<PmsCategory> children;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getSort() {
        return sort;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIcon() {
        return icon;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getUnit() {
        return unit;
    }

    public List<PmsCategory> getChildren() {
        return children;
    }

    public void setChildren(List<PmsCategory> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("parentId", getParentId())
                .append("level", getLevel())
                .append("status", getStatus())
                .append("sort", getSort())
                .append("icon", getIcon())
                .append("unit", getUnit())
                .append("children", getChildren())
                .toString();
    }
}
